from typing import TYPE_CHECKING, Union, Dict, List, Tuple, Optional

if TYPE_CHECKING:
    from frappe.database.mariadb.database import MariaDBDatabase
    from frappe.database.postgres.database import PostgresDatabase
    from frappe.query_builder.builder import MariaDB, Postgres
    from frappe_dm.database.dm.database import DmDatabase
    from frappe_dm.query_builder.builder import Dm

    DBType = Union[MariaDBDatabase, PostgresDatabase, DmDatabase]
    QBType = Union[MariaDB, Postgres, Dm]
    Query = Union[str, MariaDB, Postgres, Dm]
    QueryValues = Optional[Union[Tuple, List, Dict]]

# 常量定义
EmptyQueryValues = object()
FallBackDateTimeStr = "0001-01-01 00:00:00.000000"
DefaultOrderBy = "KEEP_DEFAULT_ORDERING"
NestedSetHierarchy = (
    "ancestors of",
    "descendants of",
    "not ancestors of",
    "not descendants of",
    "descendants of (inclusive)",
)

# 导出所有类型和常量
__all__ = [
    'Query', 
    'EmptyQueryValues',
    'FallBackDateTimeStr',
    'DefaultOrderBy',
    'NestedSetHierarchy'
]